package com.dandelion.manager.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dandelion.commons.spring.SpringContextHolder;
import com.dandelion.commons.web.model.AjaxResponse;
import com.dandelion.commons.web.model.DataGrid;
import com.dandelion.manager.system.domain.Global;
import com.dandelion.manager.system.repository.GlobalMapper;
import com.dandelion.manager.system.service.GlobalService;

@Service
public class GlobalServiceImpl implements GlobalService {
	
	@Autowired
	private GlobalMapper mapper ;

	@Override
	public AjaxResponse add(Global record) {
		this.mapper.insertSelective(record) ;
		return SpringContextHolder.getBean(AjaxResponse.class).reset() ;
	}

	@Override
	public AjaxResponse delete(long id) {
		this.mapper.deleteByPrimaryKey(id) ;
		return SpringContextHolder.getBean(AjaxResponse.class).reset() ;
	}
	
	@Override
	public AjaxResponse deleteBatch(Long[] ids) {
		this.mapper.deleteByPrimaryKeys(ids) ;
		return SpringContextHolder.getBean(AjaxResponse.class).reset() ;
	}


	@Override
	public AjaxResponse update(Global record) {
		this.mapper.updateByPrimaryKeySelective(record) ;
		return SpringContextHolder.getBean(AjaxResponse.class).reset() ;
	}

	@Override
	public Global get(long id) {
		return this.mapper.selectByPrimaryKey(id) ;
	}

	@Override
	public List<Global> getAllList(Global record) {
		return this.mapper.selectAllList(record);
	}
	
	@Override
	public DataGrid<Global> datagrid(Global conditions) {
		return null;
	}
}
